package com.yidu.ruifeng_logistics.service.impl;

import com.yidu.ruifeng_logistics.entity.LogisticsWaybill;
import com.yidu.ruifeng_logistics.dao.LogisticsWaybillDao;
import com.yidu.ruifeng_logistics.service.LogisticsWaybillService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 运单表(LogisticsWaybill)表服务实现类
 *
 * @author makejava
 * @since 2021-03-12 15:34:23
 */
@Service("logisticsWaybillService")
public class LogisticsWaybillServiceImpl implements LogisticsWaybillService {
    @Resource
    private LogisticsWaybillDao logisticsWaybillDao;

    /**
     * 通过ID查询单条数据
     *
     * @param waybillId 主键
     * @return 实例对象
     */
    @Override
    public LogisticsWaybill queryById(Long waybillId) {
        return this.logisticsWaybillDao.queryById(waybillId);
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit  查询条数
     * @return 对象列表
     */
    @Override
    public List<LogisticsWaybill> queryAllByLimit(int offset, int limit) {
        return this.logisticsWaybillDao.queryAllByLimit(offset, limit);
    }

    /**
     * 新增数据
     *
     * @param logisticsWaybill 实例对象
     * @return 实例对象
     */
    @Override
    public LogisticsWaybill insert(LogisticsWaybill logisticsWaybill) {
        this.logisticsWaybillDao.insert(logisticsWaybill);
        return logisticsWaybill;
    }

    @Override
    public LogisticsWaybill insertSelective(LogisticsWaybill logisticsWaybill) {
         this.logisticsWaybillDao.insertSelective(logisticsWaybill);
        return logisticsWaybill;
    }

    /**
     * 修改数据
     *
     * @param logisticsWaybill 实例对象
     * @return 实例对象
     */
    @Override
    public LogisticsWaybill update(LogisticsWaybill logisticsWaybill) {
        this.logisticsWaybillDao.update(logisticsWaybill);
        return logisticsWaybill;
    }
    /**
     * 通过主键删除数据
     *
     * @param waybillId 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Integer waybillId) {
        return this.logisticsWaybillDao.deleteById(waybillId) > 0;
    }

    @Override
    public List<LogisticsWaybill> queryAll(LogisticsWaybill logisticsWaybill) {
        return this.logisticsWaybillDao.queryAll(logisticsWaybill);
    }

}
